package com.googlecode.likesql.converter;

import java.util.LinkedList;
import java.util.List;

import com.googlecode.likesql.constant.SqlConstant;

/**
 * DefaultConverter is to convert the object in a default way.
 * 
 * @author Johny Huang
 *
 */
public class DefaultConverter implements Converter {

	/**
	 * Returns ? 
	 * 
	 * @see com.googlecode.likesql.converter.Converter#toTemplate(java.lang.Object)
	 */
	public String toTemplate(Object obj) {
		return String.valueOf(SqlConstant.CHAR_FOR_REPLACE);
	}
	
	/**
	 * Returns Object.toString(). If obj is null, return "null"
	 * 
	 * @see com.googlecode.likesql.converter.Converter#toSql(java.lang.Object)
	 */
	public String toSql(Object obj){		
		return obj==null?"null":obj.toString();
	}

	public List toValueList(Object obj) {
		LinkedList list=new LinkedList();
		list.add(obj.toString());
		return list;
	}
}
